<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>问题反馈列表</title>

    <link rel="stylesheet" href="http://cdn.viptool.cn/lib/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="../../resource/hotui/css/font-awesome.min.css" th:href="@{/resource/hotui/css/font-awesome.min.css}" rel="stylesheet">
    <!-- Morris -->
    <link href="http://cdn.viptool.cn/lib/morris.js/0.4.3/morris.css" rel="stylesheet">
    <link href="http://cdn.viptool.cn/lib/animate.css/2.1.1/animate.min.css" rel="stylesheet">
    <link href="../../resource/hotui/css/style.min-1.0.8.css" th:href="@{/resource/hotui/css/style.min-1.0.8.css}" rel="stylesheet">
    <link href="../../resource/hotui/css/hotui.style.override.css" th:href="@{/resource/hotui/css/hotui.style.override.css}" rel="stylesheet"/>
    <link href="http://cdn.viptool.cn/lib/switchery/0.8.2/switchery.min.css" rel="stylesheet"/>
    <link href="http://cdn.viptool.cn/lib/bootstrap-daterangepicker/2.1.25/daterangepicker.min.css" rel="stylesheet">
    <link href="../../resource/lib/imageview/css/imageviewer.css" rel="stylesheet"/>

    <style type="text/css">
        .hr-line-dashed {
            margin: 10px 0;
            height: 1px;
            border-top: 1px dashed #e7eaec;
            background-color: #fff;
            color: #fff;
        }

        .city-picker-selector select {

        }

        .daterangepicker {
            z-index: 999999999 !important;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight tooltip-demo">
    <!--search-->
    <form role="form" id="searchForm" class="search-panel" method="get" th:object="${condition}">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox">
                    <div class="ibox-content">
                        <div class="form-inline">
                            <input type="hidden" th:value="${pageIndex}" name="pageIndex"/>
                            <input type="hidden" name="status" th:value="*{status}"/>
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="keyword">联系方式：</label>
                                <input type="text" class="form-control input-sm mb10" id="keyword" th:value="*{keyword}" name="keyword" placeholder="手机号/姓名/昵称" style="width: 156px;"/>
                            </div>
                        </div>
                        <p style="height: 8px;"></p>
                        <div class="form-inline">
                            <div class="form-group m-r-sm">
                                <label class=" control-label" for="createTimePick">提交时间：</label>
                                <input type="text" class="form-control input-sm mb10 data-range-pick" id="createTimePick" start-element="#beginTime" end-element="#endTime" placeholder="开始时间-结束时间" style="width: 277px;"/>
                                <input type="hidden" th:value="*{beginTime}" id="beginTime" name="beginTime"/>
                                <input type="hidden" th:value="*{endTime}" id="endTime" name="endTime"/>
                            </div>
                            <div class="form-group m-r-sm">
                                <button type="button" onclick="feedback.search(1)"
                                        class="btn btn-primary btn-sm m-b-none searchBtn">筛选
                                </button>
                                <button type="button" onclick="feedback.searchAll()" class="btn btn-primary btn-sm m-b-none">显示全部</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--search-->

    <!--list-->
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins m-b-none">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active" th:class="${condition.status==-1?'active':''}">
                            <a th:href="@{/feedback/list}" href="#tab-2">全部</a>
                        </li>
                        <li th:class="${condition.status==0?'active':''}">
                            <a th:href="@{/feedback/list(status=0)}">未解决</a>
                        </li>
                        <li th:class="${condition.status==1?'active':''}">
                            <a th:href="@{/feedback/list(status=1)}">已解决</a>
                        </li>
                        <li th:class="${condition.status==2?'active':''}">
                            <a th:href="@{/feedback/list(status=2)}">不予处理</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active">
                            <div class="panel-body">
                                <table class="table table-bordered table-hover table-center">
                                    <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>代理信息</th>
                                        <th>联系方式</th>
                                        <th>反馈意见</th>
                                        <th>图片</th>
                                        <th>状态</th>
                                        <th>反馈时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    <tr th:each="item:${list}">
                                        <td th:text="${item.feedId}"></td>
                                        <td>
                                            <span th:text="${item.user.realName}">王明(大区经理)</span>
                                            <br/>
                                            <span th:text="${item.user.userLevelPO.levelName}"></span>
                                            <br/>
                                            <span th:text="${item.user.username}">17678767675</span>
                                        </td>
                                        <td th:text="${item.contactWay}"></td>
                                        <td th:text="${item.opinions}"></td>
                                        <td>
                                            <a class="imgView" th:if="${item.feedImg!=null&&item.feedImg.length()>0}" th:attr="data-url=${@resourceService.get(item.feedImg).getURI()}">
                                                点击查看大图
                                            </a>
                                        </td>
                                        <td>
                                            <th:block th:if="${item.feedBackStatus==0}"><span style="color: red;">未解决</span></th:block>
                                            <th:block th:if="${item.feedBackStatus==1}"><span style="color: #00b7ee">已解决</span></th:block>
                                            <th:block th:if="${item.feedBackStatus==2}"><span style="color: #1E0FBE">不予处理</span></th:block>


                                        </td>
                                        <td th:text="${#temporals.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                        <td>
                                            <th:block th:if="${item.feedBackStatus==0}">
                                                <button onclick="withdrawalHandler.agree('123')" th:onclick="|feedback.check('${item.feedId}',1)|" type="button"
                                                        class="btn btn-primary btn-xs m-b-none">已解决
                                                </button>
                                                <button onclick="withdrawalHandler.disagree('123')" th:onclick="|feedback.check('${item.feedId}',2)|" type="button"
                                                        class="btn btn-danger btn-xs m-b-none">不予处理
                                                </button>
                                            </th:block>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <p style="float: left; margin: 20px 0;">
                                    共<span th:text="${totalRecords}"></span>条记录，当前第<span th:text="${pageIndex}"></span>/<span th:text="${totalPages==0?1:totalPages}"></span>，每页20条记录
                                </p>
                                <ul style="float: right;" class="pagination pagination-split">
                                </ul>
                                <p style="clear: both"></p>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--基础框架js-->
<script src="http://cdn.viptool.cn/lib/jquery/2.2.4/jquery.min.js"></script>
<script src="http://cdn.viptool.cn/lib/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316" th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-utils.js?20190316}"></script>
<script src="../../resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316" th:src="@{/resource/hotui/js/hot/bootstrap.hot.extra-init.js?20190316}"></script>
<script src="../../resource/hotui/js/content.min.js" th:src="@{/resource/hotui/js/content.min.js}"></script>
<script src="http://cdn.viptool.cn/lib/moment.js/2.19.2/moment.min.js"></script>
<script src="../../resource/hotui/js/plugins/datetimepick/js/daterangepicker.js"
        th:src="@{/resource/hotui/js/plugins/datetimepick/js/daterangepicker.js}"></script>
<script src="../../resource/lib/imageview/js/imageviewer.min.js" th:src="@{/resource/lib/imageview/js/imageviewer.min.js}"></script>

<script type="text/javascript" th:inline="javascript">
    const pageIndex = /*[[${pageIndex}]]*/  1;
    const totalPages = /*[[${totalPages}]]*/  0;
    const pageUri = /*[[@{/feedback/list}]]*/  "";
</script>

<script>


    $(function () {
        //初始化分页
        var pageinate = new hot.paging(".pagination", pageIndex, totalPages, 7);

        pageinate.init(function (p) {
            withdrawalHandler.search(p);
        });


        var viewer = ImageViewer();
        $('.imgView').click(function () {
            var imgSrc = $(this).attr("data-url"),
                highResolutionImage = $(this).data('high-res-img');

            viewer.show(imgSrc, highResolutionImage);
        });


        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".searchBtn").trigger("click");
            }
        });
    });

    var feedback = {
        search: function (pageIndex) {
            $("input[name=pageIndex]").val(pageIndex);
            $("#searchForm").submit();
        },
        searchAll: function () {
            window.location.href = pageUri;
        },
        check: function (dataId, status) {
            hot.confirm("确定执行此操作？", function () {
                hot.ajax("/feedback/check", {
                    id: dataId,
                    status: status
                }, function (apiResult) {
                    if (apiResult.resultCode === 2000) {
                        hot.tip.success("操作成功", function () {
                            window.location.reload();
                        })
                    } else {
                        hot.tip.error("操作失败--" + apiResult.resultMsg);
                    }
                }, function () {
                }, "post", 300);
            });
        }
    };
</script>
</body>
</html>
